package net.gazhi.delonix.rbac.entity;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;

import org.hibernate.validator.constraints.NotEmpty;

/**
 * 群组
 * 
 * @author Jeffrey Lin
 *
 */
@Entity(name = DX_TABLE.dx_group)
public class Group {

	@ManyToOne
	@JoinColumn(name = "parent_id", nullable = true)
	private Group parent;

	@Id
	@GeneratedValue(strategy = GenerationType.TABLE)
	private int id;

	@Column
	@NotEmpty(message = "群组名称不能为空！")
	private String name;

	public Group getParent() {
		return parent;
	}

	public void setParent(Group parent) {
		this.parent = parent;
	}

	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

}
